@echo off
REM 创建必要的目录
if not exist data mkdir data
if not exist data\uploads mkdir data\uploads

REM 标志变量，初始值为false
set "browser_started=false"

REM 检查 lan-chat-win.exe 是否存在
if exist lan-chat-win.exe (
    REM 如果存在则运行 lan-chat-win.exe 并设置标志变量为true
    start "" lan-chat-win.exe
    set "browser_started=true"
) else (
    if exist lan-chat.exe (
        REM 如果 lan-chat-win.exe 不存在但 lan-chat.exe 存在，则运行 lan-chat.exe 并设置标志变量为true
        start "" lan-chat.exe
        set "browser_started=true"
    ) else (
        REM 如果 lan-chat-win.exe 和 lan-chat.exe 都不存在，给出提示并等待按键
        echo Cannot find lan-chat-win.exe or lan-chat.exe.
        echo Please ensure at least one application exists, then try again.
        pause
    )
)

REM 如果标志变量为true，则启动浏览器并打开指定URL
if "%browser_started%"=="true" (
    start "" "http://localhost:3000"
)